<?php
/**
 * Created by PhpStorm.
 * User: xiaxiang
 * Date: 2019/3/15
 * Time: 23:16
 */

namespace App\Http\Controllers\Admin;
use Illuminate\Support\Facades\Route;

class BaseController
{
    public function __construct()
    {
        $uri = Route::current()->uri;
        //获取路由名称中的第二个值
        $controllerName = "";
        $arr = explode('/',$uri);
        if(isset($arr)) {
            $controllerName = $arr[1];
        }
        view()->share(['menuControllerName'=>$controllerName]);
    }
}